<!DOCTYPE html>
<html lang="en">
<!-- 古韵超市 · 所有商品页面 -->
<?php
//判断是否非法访问
session_start();
if (!isset($_SESSION['USERINFOS'])) {
    echo "<script>alert('非法访问！');window.location.href='login_reg.html';</script>";
    exit();
}

?>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>古韵超市 · 所有商品</title>
    <link rel="stylesheet" href="bootstrap-5.3.3-dist/bootstrap.min.css">
    <script src="bootstrap-5.3.3-dist/bootstrap.min.js"></script>
    <link rel="stylesheet" href="css/u_public.css">
    <link rel="stylesheet" href="css/all_goods.css">
    <script src="js/get-goods.js"></script>
</head>

<body>
    <!-- 导航 -->
    <div class="navbar fixed-top">
        <nav class="navbar navbar-expand-lg navbar-light bg-light" id="navbar">
            <div class="container-fluid">
                <div class="logo_div">
                    <img src="img/LOGO.png">
                </div>
                <a class="navbar-brand" href="#">古韵超市网上购物系统</a>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
                    data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                    aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                    <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                        <li class="nav-item">
                            <a class="nav-link" aria-current="page" href="../index.php">首页</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link active" aria-current="page" href="javascript:;">所有商品</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="u_mycart.php">我的购物车</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="u_show_order.php">我的订单</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="u_history_order.php">历史订单</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="u_personal_info.php">我的信息</a>
                        </li>
                    </ul>
                    <div class="infobox">
                    当前登录：<?php echo $_SESSION['USERINFOS']['uname'];?>  |
                        <a href="php/logout.php">退出登录</a>
                    </div>
                </div>
            </div>
        </nav>
    </div>
    <main>
        <div class="mb-3 row search_top">
            <div class="col-sm-4">
                <input type="text" class="form-control" id="search_input" placeholder="请输入商品名称"
                    aria-label="search_input">
            </div>
            <div class="col-sm-2">
                <button type="button" class="btn btn-primary mb-3" onclick="by_name();">查询商品</button>
            </div>
            <div class="col-sm-6">
                <button type="button" class="btn btn-outline-success mb-3" onclick="by_type('vegetable');">蔬菜分类</button>
                <button type="button" class="btn btn-outline-warning mb-3" onclick="by_type('grain');">粮油分类</button>
                <button type="button" class="btn btn-outline-info mb-3" onclick="by_type('fruit');">水果分类</button>
                <button type="button" class="btn btn-outline-primary mb-3" onclick="by_type('seafood');">生鲜分类</button>
                <button type="button" class="btn btn-outline-secondary mb-3" onclick="by_type('all');">所有商品</button>
            </div>
        </div>
        <div class="goods_list" id="goods_list">
            <?php
                include_once("php/get-goods.php");
            ?>
        </div>
    </main>
    <footer class="fixed-bottom">
        古韵超市网上购物系统© 2025® All Rights Reserved.
    </footer>
</body>

</html>